package com.dsj.gxrd.modules.controller.activity;

import com.dsj.gxrd.modules.activity.domain.query.RdNewsQuery;
import com.dsj.gxrd.modules.activity.domain.vo.RdActivityTendencyVo;
import com.dsj.gxrd.modules.activity.domain.vo.RdFiveActivityVo;
import com.dsj.gxrd.modules.activity.domain.vo.RdNewsRankVo;
import com.dsj.gxrd.modules.activity.domain.vo.RdNewsVo;
import com.dsj.gxrd.modules.activity.service.RdNewsService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.Delayed;


/**
 * ok
 * @author songpin566
 * @date 2023/09/14
 **/
@Api(tags = "文章新闻")
@RestController
@RequestMapping("/activity/news")
public class RdNewsController extends BaseController {

    @Autowired
    private RdNewsService rdNewsService;

    @GetMapping("/list")
    public TableDataInfo list(RdNewsQuery rdNewsQuery) {
        startPage();
        List<RdNewsVo> list = rdNewsService.selectRdNewsList(rdNewsQuery);
        return getDataTable(list);
    }

    /**
     * 人大常委会带图片的最新五条数据
     */
    @GetMapping("/image/list")
    public AjaxResult getImageFiveList() {
        List<RdNewsVo> list = rdNewsService.getImageFiveList();
        return AjaxResult.success(list);
    }

    /**
     * 人大常委会最新头条3条
     */
    @GetMapping("/head/list")
    public AjaxResult getNewestHeadNews() {
        List<RdNewsVo> list = rdNewsService.getNewestHeadNews();
        return AjaxResult.success(list);
    }

    /**
     * 履职活动
     */
    @GetMapping("/summary")
    public TableDataInfo summaryList(Long deptId) {
        startPage();
        List<RdNewsVo> list = rdNewsService.selectSummaryList(deptId);
        return getDataTable(list);
    }

    @ApiOperation(value = "查询新闻信息详情")
    @GetMapping("/{rdNewsId}")
    public AjaxResult getInfo(@PathVariable Long rdNewsId) {
        RdNewsVo rdNewsVo=rdNewsService.getInfo(rdNewsId);
        return AjaxResult.success(rdNewsVo);
    }

    /**
     * 活动数量排名
     */
    @GetMapping("/rank")
    public AjaxResult activityRank() {
        List<RdNewsRankVo> list = rdNewsService.activityRank();
        return AjaxResult.success(list);
    }

    /**
     * 活动数量趋势
     */
    @GetMapping("/tendency")
    public AjaxResult activityTendency() {
        Map<Integer, List<RdActivityTendencyVo>> map = rdNewsService.activityTendency();
        return AjaxResult.success(map);
    }

    /**
     * 五大活动
     */
    @GetMapping("/five/activity")
    public AjaxResult fiveActivity() {
        List<RdFiveActivityVo> list = rdNewsService.fiveActivity();
        return AjaxResult.success(list);
    }


}
